<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */

$this->main_menu = MenuHelper::getArrayForMainMenu(true, false, false);

?>

<?php
$this->widget('bootstrap.widgets.TbTabs', array(
    'type'=>'tabs', // 'tabs' or 'pills'
    'tabs'=> array(
        array('label'=>'Alle Kunden', 'url'=>$this->createUrl('user/admin'), 'active'=>false),
        array('label'=>'NEU', 'url'=>$this->createUrl('user/create'), 'active'=>false),
//        array('label'=>'|', 'itemOptions'=>array('class'=>'disabled')),
        array('label'=>'Stammdaten', 'url'=>$this->createUrl('user/update', array('id'=>$model->user_id)), 'active'=>true),  
        array('label'=>'Info', 'url'=>$this->createUrl('user/info', array('user_id'=>$model->user_id)), 'active'=>false),
        array('label'=>'Rechnungsadressen', 'url'=>$this->createUrl('user/viewInvoiceAddresses', array('user_id'=>$model->user_id)), 'active'=>false),
        array('label'=>'Kurse', 'url'=>$this->createUrl('user/getCourseForUser', array('id'=>$model->user_id))),
//        array('label'=>'|', 'itemOptions'=>array('class'=>'disabled')),
        
    ),
));
?>

<?php 
   $salutationArray = $this->modelToArray(Salutation::model()->findAll());
   $partner = $this->modelToArray(Partner::model()->findAll());
   $status = $this->modelToArray(UserStatus::model()->findAll());
   asort($status);
   $a = $this->advisorArray(Advisor::model()->findAll());
   $advisor = array(0 => "") + $a;
   $recorded_by = array('Svetlana'=>'Svetlana', 'Claudia'=>'Claudia', 'Bruno'=>'Bruno','Jasmine'=>'Jasmine', 'Stefanie'=>'Stefanie', 'Simon'=>'Simon',);
   $ams = ModelHelper::amsModelToArray(Ams::model()->findAll());
?>
    
<?php    
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'horizontalForm',
	'type'=>'horizontal',
)); ?>
     
<fieldset>

    <?php echo $form->dropDownListRow($model, 'salutation', array_combine($salutationArray, $salutationArray)); ?>
    <?php echo $form->textFieldRow($model, 'title'); ?>
    <?php echo $form->textFieldRow($model, 'first_name'); ?>
    <?php echo $form->textFieldRow($model, 'last_name'); ?>
    <?php echo $form->textFieldRow($model, 'internal_nr'); ?>
    <?php echo $form->textFieldRow($model, 'address'); ?>
    <?php echo $form->textFieldRow($model, 'postcode'); ?>
    <?php echo $form->textFieldRow($model, 'place'); ?>
    <?php echo $form->textFieldRow($model, 'tel'); ?>
    <?php echo $form->textFieldRow($model, 'mobile'); ?>
    <?php echo $form->textFieldRow($model, 'email'); ?>
    <?php echo $form->checkBoxRow($model, 'newsletter', array('disabled'=>false)); ?>
    <?php echo $form->dropDownListRow($model, 'educational_partner', array_combine($partner, $partner)); ?>
    <?php // echo $form->textAreaRow($model, 'info'); ?>
    <?php echo $form->dropDownListRow($model, 'recorded_by', $recorded_by); ?>
    <?php echo $form->textFieldRow($model, 'recorded_at', array('disabled'=>true,)); ?>
    <?php echo $form->textFieldRow($model, 'birthday'); ?>
    <?php echo $form->textFieldRow($model, 'social_security_nr'); ?>
    <?php echo $form->dropDownListRow($model, 'status', array_combine($status, $status)); ?>
    

    <?php
    echo $form->dropDownListRow($model, 'advisor1', array_combine($advisor, $advisor),
    array(
        'ajax' => array(
            'type'=>'POST', //request type
            'url'=>CController::createUrl('user/insertAdvisorEmail'), //url to call.
            'update'=>'#advisor_email', //selector to update
        )
    ));   
    ?>  

    <div id="advisor_email">		
            <?php echo $form->textFieldRow($model, 'advisor_email'); ?>
    </div> 
    
    <?php echo $form->dropDownListRow($model, 'advisor2', array_combine($advisor, $advisor)); ?>

    <?php echo $form->dropDownListRow($model, 'ams_district', array_combine($ams, $ams)); ?>

</fieldset>
    
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Speichern')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Zurücksetzen')); ?>
</div>
 
<?php $this->endWidget(); ?>

</div><!-- form -->
